<?php
if (!defined("_INDEX")) { header("Location: /"); die; }

require_once ADMIN.DS."/head.php";
?>
<h1>Список новостей</h1><br />
<div class='floating'><a href='news/add'>Добавить новость</a></div>
<table cellpadding='0' cellspacing='0' class='list'>
	<tr class='table_header'>
		<td width='50px'>ID</td>
		<td width='350px'>Заголовок</td>
		<td width='80px'>Дата</td>
		<td width='200px' class='actions'>Действия</td>
	</tr><?php
		$news = $db->getTable("select * from `news` order by `date`");
		foreach($news as $new)
		{
			echo "<tr width='50px'><td>$new[news_id]</td>";
			echo "<td width='350px'>".strip_tags($new['title'])."</td>";
			echo "<td width='80px'>".date("d.m.Y",$new['date'])."</td>";
			echo "<td width='200px' class='actions'><a href='/admin/news/edit/$new[news_id]' class='edit'>Редактировать</a> | <a href='/admin/news/delete/$new[news_id]' class='delete'>Удалить</a></td></tr>";
		}
?></table>

<?php require_once ADMIN.DS."/footer.php"; ?>